package IO;

import java.io.*;
import java.util.*;
// 需要先在项目目录下准备好一个 hello.txt 的文件，里面填充 "你好中国" 的内容
public class Demo2 {
    public static void main(String[] args) throws IOException {
        try (InputStream is = new FileInputStream("hello.txt")) {
            try (Scanner scanner = new Scanner(is, "UTF-8")) {
                while (scanner.hasNext()) {
                    String s = scanner.next();
                    System.out.print(s);
                }
            }
        }
    }
}
